home *** CD-ROM | disk | FTP | other *** search
- Path: manawatu.planet.co.nz!news
- From: ctutty@manawatu.gen.nz (Chris Tutty)
- Newsgroups: comp.lang.c
- Subject: Re: How to tell if a file exists in C
- Date: Thu, 22 Feb 1996 05:39:09 GMT
- Organization: PlaNet (NZ) Manawatu, Palmerston Nth, New Zealand +64 6 357-9245
- Message-ID: <4ggsa4$cdp@news.manawatu.gen.nz>
- References: <4eqkj6$ipo@charm.magnus.acs.ohio-state.edu> <4eqn9q$dr1@sparcserver.lrz-muenchen.de> <3121db3e.43150046@nntp.ix.netcom.com> <4ftpnk$i74@cafu.fl.net.au> <824493561snz@genesis.demon.co.uk> <4g8132$mg9@cafu.fl.net.au>
- NNTP-Posting-Host: ctutty.manawatu.gen.nz
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: Forte Free Agent v0.55
-
- als@fl.net.au (Andrew Snow) wrote:
- >Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
- >>In article <4ftpnk$i74@cafu.fl.net.au> als@fl.net.au "Andrew Snow" writes:
- >>>If you want to see if the file is readable as well as exists,
- >>Can a file be readable yet not exist?
- >No, but did you really want me to spell it out? You ought to have
- >been able to figure it out. Sorry if you couldn't.
- >
- That's what I need!!! :-) Non-existent readable files. Simplify your
- testing, avoid cluttering your hard drive with files called
- TEMP001.TMP!. Yeah!
-
- Ok, now we need an operating system that implements it. Hmmm, maybe
- opening the serial port and attaching a terminal with a monkey at the
- keyboard. Keep running the program until the monkey generates a text
- string that doesn't trigger any errors and voila! - there's your test
- file. Nope - damn, then it would exist which violates the original
- premise.
-
- Well, actually I know what you mean, but I'm not sure that Mr Kirby's
- 'Can a file be readable but not exist' is actually impossible. I
- remember a situation connecting to a server from Windows where a user
- could save files to the server, but didn't have rights to view the
- directory. The file was writable (and therefore readable) as long as
- it was open, but once closed, it no longer existed for that person.
- Don't remember the details, but we had to kick our way through several
- layers of interacting permissions to sort it out.
-
- In fact, after coding my way through the maze of error values and
- security issues for accessing files from MSWord, VB and C on local and
- network drives I'm damn close to writing a small DLL which returns a
- useful value without triggering 'drive not connected' errors, or
- locking up while the machine waits for the CDROM to return, or tells
- the user that their file doesn't exist, when what's happened is
- they've spelt the directory name wrong, etc, etc, etc.
-
-
- If anyone knows of a commercial tool that can do an intelligent file
- open past network drives, removable media and sharing violations,
- please let me know.
-
- Chris
- ctutty@manawatu.gen.nz
-
-